﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Drawing.Drawing2D;
namespace UcAsp.Net.Extract
{
    public partial class Form2 : Form
    {
        //标题栏按钮的矩形区域。
        Rectangle m_rect = new Rectangle(0, 0, 1024,1024);
        public Form2()
        {
            InitializeComponent();
            //这一句是设定窗体最大化后的大小,如果不设置,窗体最大化以后会挡住任务栏
           
            this.MaximumSize = new Size(SystemInformation.WorkingArea.Width, SystemInformation.WorkingArea.Height);
            this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);
        }
       
        protected override void OnPaint(PaintEventArgs e)
        {
           base.OnPaint(e);
            e.Graphics.FillRectangle(new LinearGradientBrush(this.ClientRectangle, Color.Pink, Color.Purple, LinearGradientMode.Horizontal), 0, 0, 1024, 25);
            e.Graphics.DrawString("sdfasdfasf", this.Font, Brushes.Black,0,0);
            e.Graphics.Dispose();
            panel1.CreateGraphics().FillEllipse(new SolidBrush(Color.Aqua), 0, 0, 200, 200);
        }
        private Point m_MousePoint;
        private Point m_LastPoint;
        private void Form1_SizeChanged(object sender, System.EventArgs e)
        {
            m_rect.X = this.Bounds.Width - 95;
            m_rect.Y = 4;
            m_rect.Width = m_rect.Height = 16;
        }

        private void Form2_DragDrop(object sender, DragEventArgs e)
        {
            
        }
        
        private void Form2_MouseDown(object sender, MouseEventArgs e)
        {
            richTextBox1.Text = e.X.ToString();
            if (e.X < this.Width && e.Y < 20)
            {
                this.m_LastPoint = this.Location;
                this.m_MousePoint = this.PointToScreen(e.Location);
            }
            this.PointToScreen(e.Location);
        }

        private void Form2_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (e.X < this.Width && e.Y < 20)
                {
                    Point t = this.PointToScreen(e.Location);
                    Point l = this.m_LastPoint;

                    l.Offset(t.X - this.m_MousePoint.X, t.Y - this.m_MousePoint.Y);
                    this.Location = l;
                }
            }
            //richTextBox1.Text = e.X.ToString();
        }
        protected override void OnActivated(EventArgs e)
        {
            base.OnActivated(e);
            richTextBox1.Text = "m";
        }
        protected override void OnLeave(EventArgs e)
        {
            base.OnLeave(e);
            richTextBox1.Text = "l";
        }
        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            richTextBox1.Text = "s";
        }
        protected override void OnDeactivate(EventArgs e)
        {
            base.OnDeactivate(e);
            richTextBox1.Text = "d";
        }

        private void customControl11_Click(object sender, EventArgs e)
        {
            richTextBox1.Text =richTextBox1.Text + "s";
        }
    }
    
}
